package com.lge.clock.worldclock.util;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;

/**
 * @author lge.com
 */
public class WCPreferences {
    private static final String  SEARCHTYPE_PREFS = "SearchType";
    private static final String  DBVERSION_PREFS = "DatabaseVersion";

    private Context mContext;
    
    public WCPreferences(Context context) {
        mContext = context;
    }

    public void setSearchType(boolean value) {
        SharedPreferences.Editor editor = 
            mContext.getSharedPreferences(SEARCHTYPE_PREFS, 0).edit();
        editor.putBoolean("searchType", value);
        editor.commit();
    }

    public boolean getSearchType() {
        SharedPreferences wcPreferences = 
            mContext.getSharedPreferences(SEARCHTYPE_PREFS, 0);
        return wcPreferences.getBoolean("searchType", true);
    }

    public void setDatabaseVersion(int value) {
        SharedPreferences.Editor editor = 
            mContext.getSharedPreferences(DBVERSION_PREFS, 0).edit();
        editor.putInt("DatabaseVersion", value);
        editor.commit();
    }

    public int getDatabaseVersion() {
        SharedPreferences wcPreferences =
            mContext.getSharedPreferences(DBVERSION_PREFS, 0);
        return wcPreferences.getInt("DatabaseVersion", 0);
    }
    
}